/**
 * Anchor 组件的主题配置
 * 
 * 基于企业级设计规范 (Anchor.json) 的完整配置
 * 锚点组件样式定义
 */

import type { ComponentToken } from 'antd/es/anchor/style';

// ========== 设计 Token 常量 ==========

/**
 * 间距相关 Token
 */
const SPACING_TOKENS = {
  linkPaddingBlock: 4,
  linkPaddingInlineStart: 16,
} as const;

/**
 * Anchor 完整主题配置
 * 
 * 根据设计规范文件 Anchor.json 定义的锚点组件样式
 * 
 * @example
 * ```tsx
 * <ConfigProvider theme={{ components: { Anchor: anchorThemeConfig } }}>
 *   <Anchor>
 *     <Link href="#part-1" title="Part 1" />
 *   </Anchor>
 * </ConfigProvider>
 * ```
 */
export const anchorThemeConfig: Partial<ComponentToken> = {
  // ========== 间距配置 ==========
  linkPaddingBlock: SPACING_TOKENS.linkPaddingBlock,
  linkPaddingInlineStart: SPACING_TOKENS.linkPaddingInlineStart,
};

/**
 * 获取锚点主题配置
 * 
 * @param customConfig 自定义配置（可选）
 * @returns 合并后的主题配置
 * 
 * @example
 * ```tsx
 * const myAnchorTheme = getAnchorTheme({
 *   linkPaddingBlock: 6,
 *   linkPaddingInlineStart: 20,
 * });
 * 
 * <ConfigProvider theme={{ components: { Anchor: myAnchorTheme } }}>
 *   <Anchor><Link href="#section" title="Section" /></Anchor>
 * </ConfigProvider>
 * ```
 */
export const getAnchorTheme = (
  customConfig?: Partial<ComponentToken>
): Partial<ComponentToken> => {
  return {
    ...anchorThemeConfig,
    ...customConfig,
  };
};

/**
 * 导出 Anchor 组件的 Token 类型
 */
export type { ComponentToken as AnchorComponentToken } from 'antd/es/anchor/style';

